home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / glibc108.gz / glibc108 / glibc-1.08.1 / sysdeps / sparc / sparc8 / addmul_1.S next >
Text File  |  1994-05-16  |  3KB  |  117 lines

  1. ! SPARC v8 __mpn_addmul_1 -- Multiply a limb vector with a limb and
  2. ! add the result to a second limb vector.
  3.  
  4. ! Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
  5.  
  6. ! This file is part of the GNU MP Library.
  7.  
  8. ! The GNU MP Library is free software; you can redistribute it and/or modify
  9. ! it under the terms of the GNU Library General Public License as published by
  10. ! the Free Software Foundation; either version 2 of the License, or (at your
  11. ! option) any later version.
  12.  
  13. ! The GNU MP Library is distributed in the hope that it will be useful, but
  14. ! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  15. ! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
  16. ! License for more details.
  17.  
  18. ! You should have received a copy of the GNU Library General Public License
  19. ! along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
  20. ! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22.  
  23. ! INPUT PARAMETERS
  24. ! res_ptr    o0
  25. ! s1_ptr    o1
  26. ! size        o2
  27. ! s2_limb    o3
  28.  
  29. #include "sysdep.h"
  30.  
  31. .text
  32.     .align 4
  33.     .global    C_SYMBOL_NAME(__mpn_addmul_1)
  34. C_SYMBOL_NAME(__mpn_addmul_1):
  35.     orcc    %g0,%g0,%g2
  36.     ld    [%o1+0],%o4    ! 1
  37.  
  38.     sll    %o2,4,%g1
  39.     and    %g1,(4-1)<<4,%g1
  40.     sethi    %hi(LL),%g3
  41.     or    %g3,%lo(LL),%g3
  42.     jmp    %g3+%g1
  43.     nop
  44. LL:
  45. LL00:    add    %o0,-4,%o0
  46.     b    Loop00        /* 4, 8, 12, ... */
  47.     add    %o1,-4,%o1
  48.     nop
  49. LL01:    b    Loop01        /* 1, 5, 9, ... */
  50.     nop
  51.     nop
  52.     nop
  53. LL10:    add    %o0,-12,%o0    /* 2, 6, 10, ... */
  54.     b    Loop10
  55.     add    %o1,4,%o1
  56.     nop
  57. LL11:    add    %o0,-8,%o0    /* 3, 7, 11, ... */
  58.     b    Loop11
  59.     add    %o1,-8,%o1
  60.     nop
  61.  
  62. 1:    addcc    %g3,%g2,%g3    ! 1
  63.     ld    [%o1+4],%o4    ! 2
  64.     rd    %y,%g2        ! 1
  65.     addx    %g0,%g2,%g2
  66.     ld    [%o0+0],%g1    ! 2
  67.     addcc    %g1,%g3,%g3
  68.     st    %g3,[%o0+0]    ! 1
  69. Loop00:    umul    %o4,%o3,%g3    ! 2
  70.     ld    [%o0+4],%g1    ! 2
  71.     addxcc    %g3,%g2,%g3    ! 2
  72.     ld    [%o1+8],%o4    ! 3
  73.     rd    %y,%g2        ! 2
  74.     addx    %g0,%g2,%g2
  75.     nop
  76.     addcc    %g1,%g3,%g3
  77.     st    %g3,[%o0+4]    ! 2
  78. Loop11:    umul    %o4,%o3,%g3    ! 3
  79.     addxcc    %g3,%g2,%g3    ! 3
  80.     ld    [%o1+12],%o4    ! 4
  81.     rd    %y,%g2        ! 3
  82.     add    %o1,16,%o1
  83.     addx    %g0,%g2,%g2
  84.     ld    [%o0+8],%g1    ! 2
  85.     addcc    %g1,%g3,%g3
  86.     st    %g3,[%o0+8]    ! 3
  87. Loop10:    umul    %o4,%o3,%g3    ! 4
  88.     addxcc    %g3,%g2,%g3    ! 4
  89.     ld    [%o1+0],%o4    ! 1
  90.     rd    %y,%g2        ! 4
  91.     addx    %g0,%g2,%g2
  92.     ld    [%o0+12],%g1    ! 2
  93.     addcc    %g1,%g3,%g3
  94.     st    %g3,[%o0+12]    ! 4
  95.     add    %o0,16,%o0
  96.     addx    %g0,%g2,%g2
  97. Loop01:    addcc    %o2,-4,%o2
  98.     bg    1b
  99.     umul    %o4,%o3,%g3    ! 1
  100.  
  101.     addcc    %g3,%g2,%g3    ! 4
  102.     rd    %y,%g2        ! 4
  103.     addx    %g0,%g2,%g2
  104.     ld    [%o0+0],%g1    ! 2
  105.     addcc    %g1,%g3,%g3
  106.     st    %g3,[%o0+0]    ! 4
  107.     addx    %g0,%g2,%o0
  108.  
  109.     retl
  110.      nop
  111.  
  112.  
  113. !    umul, ld, addxcc, rd, st
  114.  
  115. !    umul, ld, addxcc, rd, ld, addcc, st, addx
  116.  
  117.